package cn.edu.scau.cmi.luotiansheng_chapter10;

import java.io.*;

public class Example10_8 {
	public static void main(String[] args) {
		RandomAccessFile f1=null;
		int data[]= {1,2,3,4,5,6,7,8,9,10};
		try {
			f1=new RandomAccessFile("tom.dat", "rw");
			for(int i=0;i<data.length;i++) {
				f1.writeInt(data[i]);
			}
			
			for(int i=data.length-1;i>=0;i--) {
				f1.seek(i*4);
				System.out.printf("\t%d",f1.readInt());
			}
			f1.close();
		}catch(IOException e) {
			
		}
	}
}
